<?php
$http = new swoole_http_server("0.0.0.0", 3333);

$http->set([
    'document_root' => '/home/www/swoole', // v4.4.0以下版本, 此处必须为绝对路径
    'enable_static_handler' => true,
]);

$http->on('request', function ($request, $response) {
    if($request->server['request_uri'] == '/favicon.ico') {
        $response->header('Content-Type', 'image/x-icon');
        $response->status(404);
        $response->end("Not Found");
    }else{
        $response->end("你好客户端，我是swoole");
        var_dump($request->get);
        $response->header('content-type', 'image/jpeg', true);
        $response->cookie("username","境地");
        $response->status(300);
        $response->redirect("http://www.baidu.com");
    }
});
$http->start();